package com.example.person_web.core.controller;

import com.example.person_web.common.WrapperResponse;
import com.example.person_web.core.dto.SearchEngineDTO;
import com.example.person_web.core.service.SearchEngineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/core/web/searchengine")
public class SearchEngineController {
    @Autowired
    private SearchEngineService searchEngineService;

    @PostMapping("/query")
    public WrapperResponse querySearchEngine(@RequestBody SearchEngineDTO searchEngineDTO) {
        return searchEngineService.querySearchEngine(searchEngineDTO);
    }

    @PostMapping("/add")
    public WrapperResponse saveSearchEngine(@RequestBody SearchEngineDTO searchEngineDTO) {
        return searchEngineService.saveSearchEngine(searchEngineDTO);
    }

    @PostMapping("/delete")
    public WrapperResponse deleteSearchEngine(@RequestBody SearchEngineDTO searchEngineDTO) {
        return searchEngineService.deleteSearchEngine(searchEngineDTO);
    }
}
